const {ethers} = require("hardhat");

async function main() {
  // 获取部署者的钱包地址
  const [deployer] = await ethers.getSigners();
  console.log("Deploying contracts with the account:", deployer.address);
  
  // 设置合约工厂
  const MyContract = await ethers.getContractFactory("LKcoin");

  // 部署合约
  const myContract = await MyContract.deploy();

  // 等待合约部署完成
  await myContract.waitForDeployment();

  // 输出合约地址
  console.log("Deployed contract address:", myContract.target);
}

// 执行主函数并处理错误
main()
  .then(() => process.exit(0))
  .catch(error => {
    console.error(error);
    process.exit(1);
  });